<?php

use yii\helpers\Html;
use yii\grid\GridView;
use ms\modules\article\models\ArticleNav;
/* @var $this yii\web\View */
/* @var $searchModel ms\modules\article\models\searchs\SearchArticleNav */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '导航栏';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="article-nav-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('添加导航', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            
            'id',
            'name',
            'sort',
            [
	            'attribute'=>'status',
	            'filter'=>['0'=>'失效','1'=>'生效'],
	            'value'=>function ($searchModel) {
	            	return ArticleNav::getNavStatus($searchModel->status);
            }
            ],
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
